const express = require('express');
const multer = require('multer')
const upload = multer({ dest: 'public/newsuploads/' })

const newsRouter = express.Router();
const NewsController = require('../../controllers/admin/NewsController')

newsRouter.post('/adminapi/news/create', upload.single('file'), NewsController.create)

newsRouter.get('/adminapi/news/list/:id', NewsController.getList)

newsRouter.put('/adminapi/news/status/:id', NewsController.changeStatus)

newsRouter.post('/adminapi/news/upload', upload.single('file'), NewsController.uploadImg)

newsRouter.delete('/adminapi/news/delete/:id', NewsController.delete)

newsRouter.post('/adminapi/news/edit', upload.single('file'), NewsController.edit)
module.exports = newsRouter;
